org.eclipse.vtp.framework.interactions.voice.vxml
Class If

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.If
All Implemented Interfaces:
VXMLConstants

public class If
extends Widget
implements VXMLConstants

The If class represents the <if> VXML element. An if element specifies a conditional expression that determines whether or not the actions it contains should be executed. It is also the container of the secondary conditional elements: ElseIf and Else. This construct follows the same rules as similar facilities of programming languages such as Java&tm;.

Version:
2.0
Author:
Trip Gilman, Lonnie Pryor

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
If(java.lang.String condition)
          Creates a new instance of If with the specified conditional expression.
 
Method Summary
 void addAction(Action action)
          Adds the action to this if.
 void addElseIf(ElseIf elseIf)
          Adds the else-if element to the set of secondary conditionals to evaluate if this element's condition evaluates to false.
 Action[] getActions()
          Returns the list of actions in this if.
 java.lang.String getCondition()
          Returns the conditional expression that must evaluate to true.
 Else getElse()
          Returns the final conditional in this if.
 ElseIf[] getElseIfs()
          Returns the list of extra conditionals in this if.
 void removeAction(Action action)
          Removes the action from this if.
 void removeElseIf(ElseIf elseIf)
          Removes the else-if element from the set of secondary conditionals to evaluate if this element's condition evaluates to false.
 void setCondition(java.lang.String condition)
          Sets the conditional expression that must evaluate to true.
 void setElse(Else elseClause)
          Sets the else element to process if this element's condition and all secondary conditions evaluate to false.
protected  void writeActions(org.xml.sax.ContentHandler outputHandler)
          Write the actions in this condition to the specified content handler.
protected  void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
          Write the attribute members of this condition to the supplied set.
protected  void writeElse(org.xml.sax.ContentHandler outputHandler)
          Write the else condition in this condition to the specified content handler.
protected  void writeElseIfs(org.xml.sax.ContentHandler outputHandler)
          Write the else-if conditions in this condition to the specified content handler.
 void writeWidget(org.xml.sax.ContentHandler outputHandler)
          Writes the content of this widget to an XML content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

If

public If(java.lang.String condition)
   throws java.lang.IllegalArgumentException,
          java.lang.NullPointerException
Creates a new instance of If with the specified conditional expression.

Parameters:
condition - A boolean expression.
Throws:
java.lang.IllegalArgumentException - If the supplied condition is empty.
java.lang.NullPointerException - If the supplied condition is null.
Method Detail

getCondition

public java.lang.String getCondition()
Returns the conditional expression that must evaluate to true.

Returns:
The conditional expression.

getActions

public Action[] getActions()
Returns the list of actions in this if.

Returns:
The list of actions in this if.

getElseIfs

public ElseIf[] getElseIfs()
Returns the list of extra conditionals in this if.

Returns:
The list of extra conditionals in this if.

getElse

public Else getElse()
Returns the final conditional in this if.

Returns:
The final conditional in this if.

setCondition

public void setCondition(java.lang.String condition)
                  throws java.lang.IllegalArgumentException,
                         java.lang.NullPointerException
Sets the conditional expression that must evaluate to true.

Parameters:
condition - The conditional expression.
Throws:
java.lang.IllegalArgumentException - If the supplied condition is empty.
java.lang.NullPointerException - If the supplied condition is null.

addAction

public void addAction(Action action)
               throws java.lang.NullPointerException
Adds the action to this if. The list of actions are written to the VXML document in the order they were added.

Parameters:
action - The action to add.
Throws:
java.lang.NullPointerException - If the supplied action is null.

removeAction

public void removeAction(Action action)
                  throws java.lang.NullPointerException
Removes the action from this if.

Parameters:
action - The action to remove.
Throws:
java.lang.NullPointerException - If the supplied action is null.

addElseIf

public void addElseIf(ElseIf elseIf)
Adds the else-if element to the set of secondary conditionals to evaluate if this element's condition evaluates to false.

Parameters:
elseIf - The secondary condition to add.
Throws:
java.lang.NullPointerException - If the supplied conditional is null.

removeElseIf

public void removeElseIf(ElseIf elseIf)
Removes the else-if element from the set of secondary conditionals to evaluate if this element's condition evaluates to false.

Parameters:
elseIf - The secondary condition to remove.
Throws:
java.lang.NullPointerException - If the supplied conditional is null.

setElse

public void setElse(Else elseClause)
Sets the else element to process if this element's condition and all secondary conditions evaluate to false.

Parameters:
elseClause - The element to process if all other conditions are not satisfied.

writeWidget

public void writeWidget(org.xml.sax.ContentHandler outputHandler)
                 throws java.lang.NullPointerException,
                        org.xml.sax.SAXException
Description copied from class: Widget
Writes the content of this widget to an XML content handler.

Specified by:
writeWidget in class Widget
Parameters:
outputHandler - The handler to write this widget to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of this widget fails.

writeAttributes

protected void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
Write the attribute members of this condition to the supplied set.

Parameters:
attributes - The attribute set to write to.
Throws:
java.lang.NullPointerException - If the supplied attribute set is null.

writeActions

protected void writeActions(org.xml.sax.ContentHandler outputHandler)
                     throws java.lang.NullPointerException,
                            org.xml.sax.SAXException
Write the actions in this condition to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the actions fails.

writeElseIfs

protected void writeElseIfs(org.xml.sax.ContentHandler outputHandler)
                     throws java.lang.NullPointerException,
                            org.xml.sax.SAXException
Write the else-if conditions in this condition to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the actions fails.

writeElse

protected void writeElse(org.xml.sax.ContentHandler outputHandler)
                  throws java.lang.NullPointerException,
                         org.xml.sax.SAXException
Write the else condition in this condition to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the actions fails.